﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Data.GameData;

namespace GUIDialogs
{
    public partial class ActiveRaceDialog : BaseDialog
    {
        public ActiveRaceDialog()
        {
            InitializeComponent();
            InitialseDialog();
        }

        private void InitialseDialog()
        {
            availableRacesListBox.Items.AddRange(Race.Races.OrderBy(race => race.Name).ToArray());
            availableRacesListBox.SelectedItem = Race.ActiveRace;

            currentRaceTextBox.Text = Race.ActiveRace != null ? Race.ActiveRace.Name : "";
        }

        public Race SelectedRace()
        {
            return availableRacesListBox.SelectedItem as Race;
        }

        protected override bool IsValid()
        {
            return availableRacesListBox.SelectedItem != null;
        }
    }
}
